@extends('layouts.home.layout')
@section("content")
    @include('layouts.home._nav')

    <div class="validation main">
        <div class="validation_title">
            <img src="{{asset('home')}}/images/yanzheng2_03.png" />
            <h1>请提交个人基本资料</h1>
        </div>
        <form action="{{url('apply/twostep')}}" name="twoForm" id="twoForm" method="post">
            <input type="hidden" name="recordid" value="{{$recordid}}">
            <div class="yzbox">
                <p>贷款额度</p>
                <div class="yzinput_box">
                    <input  placeholder="" name="fee" type="number" min="1" class="yzbox_input"/>
                    <p>万元</p>
                </div>
            </div>
            <div class="yzbox">
                <p>贷款期限</p>
                <select class="yzselect" name="time_limit">
                    <option value="">请选择</option>
                    @foreach($config['time_limit'] as $key=>$val)
                    <option value="{{$key}}">{{$val}}</option>
                    @endforeach
                </select>
            </div>
            <div class="yzbox">
                <p>职业身份</p>
                <select class="yzselect" name="job">
                    <option value="">请选择</option>
                    @foreach($config['job'] as $key=>$val)
                        <option value="{{$key}}">{{$val}}</option>
                    @endforeach
                </select>
            </div>
            <div class="yzbox">
                <p>工资发放形式</p>
                <!--<div class="radiobox"><input type="radio" name="现金" class="xianjin"/><p>现金</p><input type="radio" name="打卡" class="chuxuka"/><p>打卡</p></div>-->
                <select class="yzselect" name="salary_type">
                    <option value="">请选择</option>
                    @foreach($config['salary_type'] as $key=>$val)
                        <option value="{{$key}}">{{$val}}</option>
                    @endforeach
                </select>
            </div>
            <div class="yzbox">
                <p>月收入</p>
                <div class="yzinput_box" name="salary">
                    <input  placeholder="" class="yzbox_input" name="salary"/>
                    <p>元</p>
                </div>
            </div>
            <div class="yzbox">
                <p>社保</p>
                <select class="yzselect" name="is_social">
                    <option value="">请选择</option>
                    @foreach($config['is_social'] as $key=>$val)
                        <option value="{{$key}}">{{$val}}</option>
                    @endforeach
                </select>
            </div>
            <div class="yzbox">
                <p>您的信用情况</p>
                <select class="yzselect" name="credit">
                    <option value="">请选择</option>
                    @foreach($config['credit'] as $key=>$val)
                        <option value="{{$key}}">{{$val}}</option>
                    @endforeach
                </select>
            </div>
            <button type="button" class="nextbtn subBtn" style="margin-top:30px;">下一步</button>
        </form>
    </div>


    <script>
        //同意
        $('.isagree').change(function(){
            if($('.isagree').is(':checked')==true){
                $('.subBtn').attr('disabled',false)
            }else{
                $('.subBtn').attr('disabled',true)
            }
        })
        $(document).ready(function () {
            var twooptions = {
                success: function (data) {
                    $(".subBtn").attr('disabled',false);
                    layer.msg(data.message);
                    if(data.code=='0000'){
                        window.location.href="{{url('apply/threestep')}}"+'?recordid='+"{{$recordid}}";
                    }
                }
            };
            $(".subBtn").click(function () {
                var fm=document.forms['twoForm'];// HTML DOM 通过form 元素的name值获取
                //
                if(fm.fee.value==''){
                    layer.msg('请填写贷款额度');
                    return false;
                }
                if(fm.time_limit.value==''){
                    layer.msg('请选择贷款期限');
                    return false;
                }
               /* if(fm.city.value==''){
                    layer.msg('请选择城市');
                    return false;
                }*/
                if(fm.job.value==''){
                    layer.msg('请选择职业');
                    return false;
                }
                if(fm.salary_type.value==''){
                    layer.msg('请选择工资发放形式');
                    return false;
                }
                if(fm.salary.value==''){
                    layer.msg('请填写月收入');
                    return false;
                }
                if(fm.is_social.value==''){
                    layer.msg('请选择社保');
                    return false;
                }
                if(fm.credit.value==''){
                    layer.msg('请选择信用情况');
                    return false;
                }

                $(".subBtn").attr('disabled',true);//禁用按钮
                $("#twoForm").ajaxSubmit(twooptions);
            });
        });

    </script>
@endsection